using System;
using PEMath;

/****************************************************
// 功能：基础逻辑单位
// | Talk To [ 聊来改善地区金融服务环境，助力企业发展 ]
// | Copyright (c) 2021-2025 聊来 All rights reserved.
// | Licensed ( <a href="http://www.apache.org/licenses/LICENSE-2.0">聊来</a> )
// | @Author: 贯彻己道的云 <18970881148@qq.com>
// | DateTime: 2025/3/27 20:43:23
*****************************************************/

public abstract class LogicUnit: ILogic
{
    /// <summary>
    /// 产生UI输入时
    /// </summary>
    protected Action OnDirChange;
    
    /// <summary>
    /// 逻辑单位角色名称
    /// </summary>
    public string unitName;

    #region Key Properties
    // 逻辑位置
    public bool isPosChanged = false;
    private PEVector3 logicPos;
    public PEVector3 LogicPos {
        set {
            logicPos = value;
            isPosChanged = true;
        }
        get => logicPos;
    }
    // 逻辑方向
    public bool isDirChanged = false;
    private PEVector3 logicDir;
    public PEVector3 LogicDir {
        set {
            logicDir = value;
            isDirChanged = true;
            OnDirChange?.Invoke();
        }
        get => logicDir;
    }
    // 逻辑速度
    public PEInt LogicMoveSpeed { protected set; get; }

    /// <summary>
    /// 基础速度
    /// </summary>
    public PEInt moveSpeedBase;
    #endregion
    public abstract void LogicInit();
    public abstract void LogicTick();
    public abstract void LogicUnInit();
}

interface ILogic
{
    void LogicInit();
    void LogicTick();
    void LogicUnInit();
}
